package com.boomkeeper.core.model;

import java.util.List;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import com.boomkeeper.core.utils.DateUtils;

public class Email {

	private String account;
	
	private String passWord;
	
	private String subject;
	
	private String signature;
	
	private List<String> toList;
	
	private List<String> ccList;
	
	private boolean sendEmail;
	
	private String from;
	
	private String templateName;

	public String getAccount() {
		return account;
	}

	public String getPassWord() {
		return passWord;
	}

	public String getSubject() {
		return subject;
	}

	public String getSignature() {
		return signature;
	}

	public List<String> getToList() {
		return toList;
	}
	
	public String[] getToArray() {
		String[] toArrays = new String[this.toList.size()];
		this.toList.toArray(toArrays);
		return toArrays;
	}

	public List<String> getCcList() {
		return ccList;
	}
	
	public String[] getCcArray() {
		if(CollectionUtils.isNotEmpty(this.ccList)) {
			String[] ccArrays = new String[this.ccList.size()];
			this.ccList.toArray(ccArrays);
			return ccArrays;
		} else {
			return new String[0];
		}
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public void setSubject(String subject) {
		if (StringUtils.isBlank(subject) || new String(subject).length() <= 26) {
			this.subject = "前台门户-[LTE]-" + DateUtils.getDefaultDate() + "-版本申请发布[4GWEB]";
		} else {
			this.subject = subject;
		}
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	public void setToList(List<String> toList) {
		this.toList = toList;
	}

	public void setCcList(List<String> ccList) {
		this.ccList = ccList;
	}

	public boolean isSendEmail() {
		return sendEmail;
	}

	public void setSendEmail(boolean sendEmail) {
		this.sendEmail = sendEmail;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}
}
